<!DOCTYPE html>
<html class="ui-mobile">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<base href=".">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0">
<title>面试结果</title>
<link rel="stylesheet" href="../tool/jquery-mobile/jquery.mobile-1.4.2.min.css">
<link rel="stylesheet" href="../css/bootstrap.min.css">
<script src="../tool/jquery/jquery-1.11.2.min.js"></script>
<script src="../tool/jquery-mobile/jquery.mobile-1.4.2.min.js"></script>
<script src="../js/common.js"></script>
<style>
* {
  font-family: '微软雅黑';
  text-shadow: none;
}

#titleButton{    	
	height:30px;
	color:#ffffff;
	background: #ee721a;
	width:17%;		
	font-size: 15px;
	position: absolute;
	top:-2px;
	left: 10px;
	border:1px solid #df7100;
}
 #signout{    	
	height:30px;
	color:#ffffff;
	background: #ee721a;
	width:17%;		
	font-size: 15px;
	position: absolute;
	top:-2px;
	right: 10px;
	border:1px solid #df7100;
}
.getmsg{
	margin-top:-18px;
	height:45px;
	background:#D4D4D4 ;
	padding:1px;
}
.qiandao{
	margin-top: 20px;
	text-align: center;
	margin-bottom: 20px;
}
#checkin{
	display: block;
	width: 80%;
	font-size: 23px;
	border-radius: 4px;
	color: #ffffff;
	background: #ee721a;
	padding: 10px;
	margin: 0 auto;
}
.cancel{
	margin-left: 50px;
	border: none;
	background: #e97500;
	color: #ffffff;	
	border-radius: 4px;	
}
#msg{
	font-size: 30px;
}
#phone{
	display: block;
	margin:10px auto;
	width:88%;height:40px;
	border-radius: 4px;
	border:none;
	box-shadow: none;
}
.message{
	border-bottom: 1px solid #BBBBBB;	
}
.message p{
	position:relative;
	font-size: 15px;
	margin-left: 25px;
	line-height: 10px;
}
.span_interview {
	position:absolute;
	right:110px;
}
.span_interview_number{
	position:absolute;
	right:10px;
	top:-5px;
	padding:15px;
	background-color:#ee721a;
	color:#ffffff;
	font-size: 40px;	
}
.resume{
	margin-left:10px;
	height:50px;
	/*width:95%;*/
	background: #ffffff;
	border-bottom: 1px solid #BBBBBB;	
}
.resume_t{
	/*margin-left:30px;*/
	height:50px;
	width:100%;
	background: #ffffff;
	border-bottom: 1px solid #BBBBBB;	
}

.resume .left{
	position:absolute;
	padding:15px;
	left:20px;
}
.resume img{
	position:absolute;
	width:16px;
	height:16px;
	margin-left: 2px;
	margin-top: 18px;;
}
.resume:hover{
	background: #ee721a;
	color:#ffffff;
}
.right{
	position:absolute;
	padding:15px;
	right:10px;
}
#re4 img{
	position:absolute;
	width:16px;
	height:16px;
	margin-left: 12px;
	margin-top: 18px;
}
#back{
	position:absolute;
	top:12px;
	right:20px;
	color:#ffffff;	
}
#overlay {
	display:none;
    position: fixed;
    top: 0px;
    left: 0px;
    height:100%;
    width:100%;
    background: #000000;
    opacity:0.7;
     z-index:10;
}
.delay{
	width:50%;
	height:25%;
	background:#ffffff;
	position:fixed;
	top:25%;
	left:25%;
	z-index: 1000;
	display: none;
	border-radius: 10px;
	text-align: center;
}
.delay p{
	margin-top: 50px;
}
#per{
	color:#e97500;
}
.div_header {
	height:43px; background-color:#ee721a; margin-top:-2px; text-align:center; padding:1px;
}

.p_title {
	font-size:21px; color:#FFFFFF; margin-top: 8px;
}

.div_page {
	min-height: 494px; background: rgb(238, 238, 238);
}
.span_per {
	color:#00a2df;
}

.div_progress{
	padding:1px;
	background:#ffffff;
	width:90%;
	height:150px;
	margin:0 auto;
}
.span_progress{
	display:block;
	margin:20px auto;
	width:92%;
	color:#a9a9a9;
}

.span_color{ color:#00a2df; }

.img {
	position:absolute;
	width:30px;
	height:30px;	
	top:0;
}

.img1 { left:0%; }
.img2 { left:23%;}
.img3 { left:46%;}
.img4 { left:69%; }
.img5 { left:92%;}

.span {
	position:absolute;
	top:200%;
	color:#00a2df;
}

.span1{ left:-2%; }
.span2{ left:23%; }
.span3{ left:44%; }
.span4{ left:69%; }
.span5{ left:90%; }

#imgdiv{
	width:95%;
	margin:0 auto;
	position:relative;
	/*margin-top: 10%;*/
	height:15px;
	border-bottom: 1px solid #c0c0c0;
	overflow: visible;
}

#message{
	border-bottom: 1px solid #BBBBBB;
	margin-top:20px;	
}
#message p{
	position:relative;
	font-size: 15px;
	margin-left: 25px;
	line-height: 10px;
}

.row{
	margin-left:10px;
	height:50px;
	/*width:95%;*/
	background: #ffffff;
	border-bottom: 1px solid #BBBBBB;	
}
.row_t {
	/*margin-left:30px;*/
	height:50px;
	width:100%;
	background: #ffffff;
	border-bottom: 1px solid #BBBBBB;	
}

.row .left{
	position:absolute;
	padding:5px;
	left:20px;
}

.page {
	margin-bottom:35px;
}

</style>
</head>
<body class="ui-mobile-viewport ui-overlay-a">

<div data-role="page" id="result" data-url="result" tabindex="0" class="ui-page ui-page-theme-a ui-page-active div_page">	
	<div style="position:fixed;left:0;top:0;width:100%;z-index:200;">
		<div class="div_header">
			<p class="p_title" style="">面试结果</p>	
			<button id="titleButton" style="padding: 5px 0 5px 0;text-shadow: none;" class=" ui-btn ui-shadow ui-corner-all">返回</button>
			<button id="signout" style="padding: 5px 0 5px 0;text-shadow: none;" class=" ui-btn ui-shadow ui-corner-all">退出</button>
		</div>
	</div>
	<div class="div_header">
	</div>
	<div id="message"> 
		 <p> <span id="realName"></span></p>
		 <p id="phone"></p>
	</div>
	<div style="background:#ffffff;width:100%" class="content">
		<div class="row_t">
			<span style="position:absolute;padding:15px;margin-left:0px;">面试结果</span>
			<span class="right">
			</span>
		</div>
	</div>
	
	<div class="text-center page"></div>
	
	<input type="hidden" id="userId">
	<div class="delay"><p>正在处理请稍等...</p></div>
	<div id="overlay"></div>
</div>

<script type="text/javascript">
 
$(document).ready(function() {
	$.ajax({
		 url: common.ctx + '/sign/getCurSignUser',
		 type: 'GET',
		 async: false,
		 data: {},
		 dataType: 'json',
		 success: function(jsonData) {
			 if (jsonData.success == true) {
				 if (jsonData.data && jsonData.data[0]) {
					 $("#userId").val(jsonData.data[0].id);
					 $("#realName").text(jsonData.data[0].userName == null ? "" :jsonData.data[0].userName);
					 $("#phone").text(jsonData.data[0].phoneNumber);
					 search( { "userId" : jsonData.data[0].id });
				 } else {
					 window.location.href= common.ctx + "/static/html/sign.html";
				 }
			 } else {
				 alert(jsonData.msg);
			 }

		 },
		 error: common.ajaxError
	});
	
	$("#titleButton").click( function() { history.back() } );
	
	$("#signout").click(function() {
		 $.ajax({
			 url: common.ctx + '/sign/signout',
			 type: 'GET',
			 async: false,
			 data: {},
			 dataType: 'json',
			 success: function(jsonData) {
				 if (jsonData.success == true) {
					 window.location.href= common.ctx + "/static/html/sign.html";
				 }
			 },
			 error:common.ajaxError
		 });
	});

});

var search = function ( param ) {
	
	$(".content").children().remove();
	
	$.ajax({
		 // url: common.ctx + '/sign/getResultByUserId',
		 url: common.ctx + '/sign/getUserResultByPage',
		 type: 'GET',
		 async: false,
		 data: param,
		 dataType: 'json',
		 success: function(jsonData) {
			 if (jsonData.content) {
				 $.each(jsonData.content, function() {
					 var project = this.project || { "name": ""};
					 var fair = this.fair || { "dateString": ""};
					 var customer = project.customer || {"name": "" } ;
					 var displayL = fair.dateString + "<br>" + project.postName + " " + customer.name;
					 var displayR = (this.status == "1" ? "通过":"未通过");
						 var div = $("<div></div>").addClass("row");
					 var left = $("<span></span>").addClass("left").html(displayL);
					 var right = $("<span></span>").addClass("right").html(displayR);
					 div.append(left).append(right).appendTo($(".content"));
				 });	  
			 }
			 setPageData(jsonData);
		 },
		 error: common.ajaxError
	});
	
	
};

var setPageData = function (jsonData) {
	 var pageSize = jsonData.size || 10;
	 var totalPage = jsonData.totalPages || 1;
	 var curPageIndex = jsonData.number || 0;
	 var curPage = curPageIndex +1;
	 var page = $(".page");
	 var ul = $("<ul></ul>").addClass("pagination");
	 
	 var startpage = 1
	 if ( curPage - 2 > 0) {
		 startpage = curPage - 2;
	 }
	 var pagelist = [startpage, startpage+1, startpage+2, startpage+3, startpage+4];
	 $.each(pagelist, function() {
		 var _this = this;
		 if (this <= totalPage) {
			 if (this == curPage) {
				 ul.append( $("<li></li>").addClass("active").append( $("<span></span>").text(_this) ) );
			 } else {
				 ul.append( $("<li></li>")
				    		.append( $("<a></a>").text(this) ) 
				   			.click( function () {  search( {"page.size": pageSize, "page": _this, "userId": $("#userId").val() } ); })
				    		);
			 }
		 }
	 });
	 
	 page.children().remove();
	 page.append(ul);
};
</script>

<div class="ui-loader ui-corner-all ui-body-a ui-loader-default"><span class="ui-icon-loading"></span><h1>loading</h1></div></body></html>